const install = (Vue, vm) => {
  //===== APP ========
  //系统
  let getLocationCode = (params = {}) => vm.$u.get('/app-api/system/region/location', params) //注册
  //用户
  let setUerRegister = (params = {}) => vm.$u.post('/app-api/member/user/register', params) //注册
  let setUerPwdLogin = (params = {}) => vm.$u.post('/app-api/member/auth/login', params) //手机登录
  let setUerCodeLogin = (params = {}) => vm.$u.post('/app-api/member/auth/sms-login', params) //手机登录
  let setUerWXLogin = (params = {}) =>
    vm.$u.post('/app-api/member/auth/weixin-mini-app-login', params) //手机登录
  let setRefreshToken = (params = {}) => vm.$u.post('/app-api/member/auth/refresh-token', params) //刷新token
  let getUserInfo = () => vm.$u.get('/app-api/member/user/getV2', {})

  let getBanner = (params = {}) => vm.$u.get('/app-api/promotion/banner/list', params)
  let setBannerCount = (params = {}) =>
    vm.$u.get('/app-api/promotion/banner/add-browse-count', params)
  let getAbout = (params = {}) => vm.$u.get(apiPath.about, params)
  let getNavigation = (params = {}) => vm.$u.get(apiPath.navigations, params)
  let getServicePhone = (params = {}) => vm.$u.get(apiPath.servicePhone, params)
  let getPrivacyPolicy = (params = {}) => vm.$u.get(apiPath.privacyPolicy, params)
  let getUerAgreement = (params = {}) => vm.$u.get(apiPath.userAgreement, params)
  let getHelpList = (params = {}) => vm.$u.get(apiPath.helpList, params)
  let getHelpType = (params = {}) => vm.$u.get(apiPath.helpType, params)
  let getHelpDetails = (id) => vm.$u.get(apiPath.helpApi + id, {})
  let setTestPayments = (params = {}) => vm.$u.post(apiPath.testPayments, params)
  //-------会员接口-------
  let setWechatLogin = (params = {}) =>
    vm.$u.post('/app-api/member/auth/weixin-mini-app-login', params)
  let setBindWechatPhone = (params = {}) => vm.$u.post(apiPath.bindWechatPhone, params)
  let setUserInfoChange = (params = {}) => vm.$u.post(apiPath.userInfo, params)
  let getMyBills = (params = {}) => vm.$u.get('/app-api/pay/wallet/get', params)
  let getMyBillsList = (params = {}) => vm.$u.get(apiPath.myBillsList, params)
  let setWithdraw = (params = {}) => vm.$u.post(apiPath.withdraw, params)
  let setSupplierApply = (params = {}) => vm.$u.post(apiPath.supplierApply, params)
  let setRegimentApply = (params = {}) => vm.$u.post(apiPath.regimentApply, params)
  let setCollectorApply = (params = {}) => vm.$u.post(apiPath.collectorApply, params)
  let getNeighborCategories = (params = {}) => vm.$u.get(apiPath.neighborCategories, params)
  let getNeighborInfoList = (params = {}) => vm.$u.get(apiPath.neighborInfoList, params)
  let getNeighborVillage = (params = {}) => vm.$u.get(apiPath.neighborVillage, params)
  let getMyNeighborInfoList = (params = {}) => vm.$u.get(apiPath.myNeighborInfoList, params)
  let setNeighborRelease = (params = {}) => vm.$u.post(apiPath.neighborRelease, params)
  let getBankList = (params = {}) => vm.$u.get('/app-api/pay/bank/list', params)
  //-----商城---------
  let getGoodsPage = (params = {}) => vm.$u.get('/app-api/product/spu/page', params)
  let getGoodsList = (params = {}) => vm.$u.get('/app-api/product/spu/list-by-ids', params)
  let getGoodsDetails = (params = {}) => vm.$u.get('/app-api/product/spu/get-detail', params)
  let getProductsCategory = (params = {}) => vm.$u.get('/app-api/product/category/list', params)
  let setGoodsFavoriteCreate = (params = {}) =>
    vm.$u.post('/app-api/product/favorite/create', params)
  let getGoodsFavoriteList = (params = {}) => vm.$u.get('/app-api/product/favorite/page', params)
  let getGoodsFavoriteCount = (params = {}) =>
    vm.$u.get('/app-api/product/favorite/get-count', params)
  let DelGoodsFavorite = (params = {}) => vm.$u.get('/app-api/product/favorite/delete', params)
  let getStoreList = (params = {}) => vm.$u.get('/app-api/shop/info/page', params)
  //获得商品 SPU 分页
  let getGoodsListByPlatform = (params = {}) =>
    vm.$u.get('/app-api/product/spu/page-by-platform-category', params)

  //商品评论
  let getGoodsComment = (params = {}) => vm.$u.get('/app-api/product/comment/page', params)
  let getNewUserCoupon = (params = {}) => vm.$u.get(apiPath.newUserCoupon, params)
  let setNewCouponReceive = (params = {}) => vm.$u.post(apiPath.newCouponReceive, params)
  let getHighCategories = (params = {}) => vm.$u.get(apiPath.highCategories, params)

  let getGoodsAll = (id) => vm.$u.get(apiPath.goodsApi)
  let getPreGoodsList = (params = {}) => vm.$u.get(apiPath.preGoodsList, params)
  let getPreGoodsDetails = (id) => vm.$u.get(apiPath.preGoodsApi + id, {})
  let getGroupGoodsList = (params = {}) => vm.$u.get(apiPath.groupGoodsList, params)
  let getGroupGoodsDetails = (id) => vm.$u.get(apiPath.groupGoodsApi + id, {})

  let setCartAdd = (params = {}) => vm.$u.post('/app-api/trade/cart/add', params)
  let getCartList = (params = {}) => vm.$u.get('/app-api/trade/cart/list', params)
  let setCartDelete = (params) => vm.$u.get('/app-api/trade/cart/delete?ids=' + params.ids, {})
  let putCartCount = (params) => vm.$u.post('/app-api/trade/cart/update-count', params)
  let putCartReset = (params = {}) => vm.$u.post('/app-api/trade/cart/reset', params)

  let setPreCartAdd = (params = {}) => vm.$u.post(apiPath.preCartAdd, params)
  let getPreCartList = (params = {}) => vm.$u.get(apiPath.preCartList, params)
  let setPreCartDelete = (params) => vm.$u.post(apiPath.preCartApi + id + apiPath.del, {})
  let setPreCartIncr = (id) => vm.$u.post(apiPath.preCartApi + id + apiPath.cartIncr, {})
  let setPreCartDecr = (id) => vm.$u.post(apiPath.preCartApi + id + apiPath.cartDecr, {})
  let setPreCartSettle = (params = {}) => vm.$u.post(apiPath.preCartSettle, params)

  let getTimeGoodsList = (params = {}) => vm.$u.get(apiPath.timeGoodsList, params)
  let getTimeGoodsDetails = (params = {}) =>
    vm.$u.get('/app-api/promotion/seckill-activity/get-detail', params)
  let getTimeRange = (params = {}) => vm.$u.get(apiPath.timeRange, params)
  let getProductVideo = (params = {}) => vm.$u.get(apiPath.productVideo, params)
  let getVideoDetails = (id) => vm.$u.get(apiPath.videoApi + id, {})
  let getPickupLocker = (params = {}) => vm.$u.get(apiPath.pickupLocker, params)
  //--------订单-------
  let setOrderCreate = (params = {}) => vm.$u.post('/app-api/trade/order/create', params)
  let getOrderList = (params = {}) => vm.$u.get('/app-api/trade/order/page', params)
  let getOrderSettlement = (params = {}) => vm.$u.get('/app-api/trade/order/settlement', params)
  let setOrdersComment = (params = {}) =>
    vm.$u.post('/app-api/trade/order/item/create-comment', params)
  let setOrderPaid = (params = {}) => vm.$u.post('/app-api/trade/order/update-paid', params) //更新已支付
  let putOrderReceive = (params = {}) => vm.$u.post('/app-api/trade/order/receive', params) //确认收货
  let getOrderItem = (params = {}) => vm.$u.get('/app-api/trade/order/item/get', params) //交易订单项
  let setOrderExpress = (params = {}) =>
    vm.$u.post('/app-api/trade/order/get-express-track-list', params) //物流
  let getOrderDetail = (params) => vm.$u.get('/app-api/trade/order/get-detail', params)
  let delOrder = (params = {}) => vm.$u.get('/app-api/trade/order/delete', params) //物流
  let delOrderCancel = (id) => vm.$u.get('/app-api/trade/order/cancel', {})
  let getOrderCount = (id) => vm.$u.get('/app-api/trade/order/get-count', {})
  let setOrderPayment = (id) => vm.$u.post(apiPath.ordersApi + id + apiPath.pay, {})
  let payOrderSubmit = (params = {}) => vm.$u.post('/app-api/pay/order/submit', params) //发起支付

  //售后
  let putOrderResale = (params = {}) => vm.$u.post('/app-api/trade/after-sale/delivery', params)
  let setOrderResale = (params = {}) => vm.$u.post('/app-api/trade/after-sale/create', params)
  let getOrderResalePage = (params = {}) => vm.$u.get('/app-api/trade/after-sale/page', params)
  let getOrderResaleDetail = (params = {}) => vm.$u.get('/app-api/trade/after-sale/get', params)
  let delOrderResaleCancel = (params = {}) => vm.$u.get('/app-api/trade/after-sale/cancel', params)

  //用户收件地址
  let setAddressCreate = (params = {}) => vm.$u.post('/app-api/member/address/create', params)
  let putAddress = (params = {}) => vm.$u.post('/app-api/member/address/update', params)
  let getAddressList = (params = {}) => vm.$u.get('/app-api/member/address/list', params)
  let getAddressDetail = (params = {}) => vm.$u.get('/app-api/member/address/get', params)
  let getAddressDefault = (params = {}) => vm.$u.get('/app-api/member/address/get-default', params)
  let delAddressDel = (params = {}) => vm.$u.get('/app-api/member/address/delete', params)

  //-----购物车
  let setOrderConfirm = (id) => vm.$u.post(apiPath.ordersApi + id + apiPath.confirm, {})
  let getOrderGroup = (params = {}) => vm.$u.get(apiPath.groupGoodsOrders, params)

  let getDeliveryOrder = (params = {}) => vm.$u.get(apiPath.deliveryOrder, params)
  let getDeliveryOrderDetail = (id, params = {}) =>
    vm.$u.get(apiPath.deliveryApi + id + apiPath.products, params)
  let setDeliveryTake = (params = {}) => vm.$u.post(apiPath.deliveryApi + id + apiPath.take, params)
  let setDeliveryTakeSuccess = (params = {}) =>
    vm.$u.post(apiPath.deliveryApi + id + apiPath.takeSuccess, params)

  //分销
  //绑定推广员
  let putBrokerageBind = (params = {}) => vm.$u.post('/app-api/trade/brokerage-user/bind', params)
  ///app-api/trade/brokerage-user/rank-page-by-price
  //获得分销用户排行分页（基于用户量）
  let getBrokerageByCountPage = (params = {}) =>
    vm.$u.get('/app-api/trade/brokerage-user/rank-page-by-user-count', params)
  //获得分销用户排行分页（基于佣金）
  let getBrokerageByPricePage = (params = {}) =>
    vm.$u.get('/app-api/trade/brokerage-user/rank-page-by-price', params)
  //获得分销用户排行分页（基于佣金）
  let getBrokerageDetail = (params = {}) => vm.$u.get('/app-api/trade/brokerage-user/get', params)

  //let getBrokerageDetail =  (params = {}) => vm.$u.get("/app-api/trade/brokerage-user/get-summary", params);
  //优惠券
  let postCouponTake = (params = {}) => vm.$u.post('/app-api/promotion/coupon/take', params)
  let getCouponPage = (params = {}) => vm.$u.get('/app-api/promotion/coupon/page', params)
  //商品匹配优惠券
  let getCouponMatchList = (params = {}) =>
    vm.$u.get('/app-api/promotion/coupon/match-list', params)
  let getGainCoupon = (params = {}) => vm.$u.get('/app-api/promotion/coupon/get', params)
  let getCouponNotUse = (params = {}) =>
    vm.$u.get('/app-api/promotion/coupon/get-unused-count', params)

  vm.$u.api = {
    setWechatLogin,
    setUerRegister,
    setUerPwdLogin,
    getGoodsComment,
    getGoodsPage,
    setGoodsFavoriteCreate,
    getGoodsFavoriteList,
    getGoodsFavoriteCount,
    DelGoodsFavorite,
    getOrderSettlement,
    setOrderPaid,
    getOrderCount,
    delOrder,
    putOrderReceive,
    getOrderItem,
    setOrderExpress,
    setOrdersComment,
    putCartReset,
    putCartCount,
    setCartDelete,
    setCartAdd,
    getCartList,
    putOrderResale,
    setOrderResale,
    getOrderResalePage,
    getOrderResaleDetail,
    delOrderResaleCancel,
    setAddressCreate,
    putAddress,
    getAddressList,
    getAddressDetail,
    getAddressDefault,
    delAddressDel,
    postCouponTake,
    getCouponPage,
    getCouponMatchList,
    getCouponNotUse,
    getGoodsList,
    getGoodsDetails,
    getUserInfo,
    setOrderCreate,
    getOrderDetail,
    getLocationCode,
    getStoreList,
    getGoodsListByPlatform,
    payOrderSubmit,
    getBankList,
    // 	getBanner,
    // 	getAbout,
    // 	getNavigation,
    // 	getServicePhone,
    // 	getPrivacyPolicy,
    // 	getUerAgreement,
    // 	getHelpList,
    // 	getHelpType,
    // 	getHelpDetails,
    // 	setTestPayments,
    //
    // 	setBindWechatPhone,
    //
    // 	setUserInfoChange,
    getMyBills,
    getMyBillsList,
    // 	setWithdraw,
    // 	setSupplierApply,
    // 	setRegimentApply,
    // 	setCollectorApply,
    // 	getNeighborCategories,
    // 	getNeighborInfoList,
    // 	getNeighborVillage,
    // 	getMyNeighborInfoList,
    // 	setNeighborRelease,
    // 	getNewUserCoupon,
    // 	setNewCouponReceive,
    // 	getHighCategories,
    // 	getProductsCategory,
    // 	getGoodsAll,
    //
    //
    // 	getPreGoodsList,
    // 	getPreGoodsDetails,
    // 	getGroupGoodsList,
    // 	getGroupGoodsDetails,

    // 	setPreCartAdd,
    // 	getPreCartList,
    // 	setPreCartDelete,
    // 	setPreCartIncr,
    // 	setPreCartDecr,
    // 	setPreCartSettle,
    // 	getTimeGoodsList,
    getTimeGoodsDetails
    // 	getTimeRange,
    // 	getProductVideo,
    // 	getVideoDetails,
    // 	getPickupLocker,
    //
    // 	setOrderPayment,
    // 	getOrderList,
    // 	getResaleOrderList,
    //
    // 	setOrderCancel,
    // 	setOrderConfirm,
    // 	getDeliveryOrder,
    // 	getDeliveryOrderDetail,
    // 	setDeliveryTake,
    // 	setDeliveryTakeSuccess,
    //
    // 	getOrderGroup
  }
}

export default {
  install
}
